Fixed setTimeout being called globally