Fix a couple of JavaScript errors