fixed wrong placed function after refactoring