Fixed User unit tests and added error handling