Fixed NPEs in tests.