Fix some JSHint warnings and other minor fixes