Fix crash in user registration