fixing error handling and updating users