fixed typo in JavaScript and exception in Python