Properly fix the POLLHUP issue