fix null pointer bug on certain test runs