Fixed some refactoring errors