fixes for non-blocking sockets