fix bug where poll does not accept -1 as argument