better error messages, JSHint fixes