Fix crash if user record is undefined