removed possible NPE
removed NPEs from test cases