Quite a few changes concerning null pointers in tests and other small changes to fix half of the test failures.