Fix for a possible unit test failure, as well as more verification in unit tests