fixed most of the issues found by jsHint

... and accidentally found some namespace related problems