Refactoring bugs fixed 2