Made polling more robust and fixed url encoding