Fixed a bug introduced while refactoring