Correcting unreferenced js variables