Added a test for claim user

Also added some null checks in other functions.