Fixed undefined index errors.
Added new is_user_valid() method. #857