fixed a bug introduced during refactoring