fixed unit test, added null check