Fix for not handling EWOULDBLOCK properly