Fixed some general errors in the JavaScript file