fix flush, wait api idle