improved ready_fd call