Fix for bugs in poll