Fixed a bug introduced in refactoring