Fixes bug with charCode, bad 'var' and missing semicolon