fix script in html page after JS refactoring