fixed weird refactoring bug