Added some POLLHUP handling as well