refactoring bugs