fix: refactor _complete function
changed to _onBeforeComplete