Fixed crash bug which was assuming that fd_ptr was always non-null