fixed bug in polling script