Fix errors in implemented refactoring