Fixed a few socket and epoll related errors.