fixing some bugs/jshint issues