Fix bug from refactoring