Fixed some of the JavaScript related code.