Re #1310 Fixing null pointer exceptions in tests.