make jslint happy

some subtles bugs and the semicolon stuff sometimes breaks 
with minification