fixed errors in JS