Fixing exception in user id checking