Fix bug introduced in refactor