Fixed bugs for findUser to comply with test cases