Fixing polling JS