corrected some if conditions in poll()