Fixed a bug caused by refactoring.