fixes a bunch of problems found by js lint