Fix bug affecting unit tests