Fix problems caused by refactoring