fixed some refactoring mistakes