fixed onComplete bug