Fix a few bugs, compatibility with Firefox, missing semi-colons, etc.