Fixing more refactoring bugs