minor bug fixes and jshint fixes