Fixed jshint warnings and errors