Corrected order of call in script tag