fix the code according to jshint warnings