fix most of errors reported by jslint