Fixed onComplete bug caused by too early call to pump()