corrected several faulty var declarations