Fix bug introduced by refactoring