Fix regressions caused by refactoring