Fix pylint errors and add some try/catch to avoid tracebacks

Some functions were referencing a variable 'user' but the variable was not guaranteed to be passed into the function.