fixed bug created by the refactoring