fixed infinite loop on reload