Fixed EAGAIN dead loop