Bug fix for refactoring before