jshint fixes, one bug fix