Fix some errors revealed by JSLint