fixed undef vars in .js