Fix a JavaScript bug