Fix errors introduced by refactoring