NPE in tests fixed