BUG refactoring fix