Add additional null check for unit tests. Fixes #154