Fixes for JSHint warnings and errors