Add error handling for undefined user