Some cleanup. Maybe even a minor bugfix - bad variable name.

Hey! You have an awesome project. I use it exclusively on my work machine with Mint 17.
I found some missing semicolons, some ambiguous use of ==, some leaked global variables, and even what looked like a bad variable name (bug).

I'd like to help and contibute so I thought a good way would be to help and learn about this project would be to clean up some of the code.