Fix some refactoring mistakes