fix reference error in compileScript