Fix UserRepository class and add more test cases