Fix for bug found during running unit tests