Added a safeguard to the polling js