Clean up JS to fix errors.