NPE fix in test cases.