Bug fix for bug introduced on refactor