better error handling on user registration