fix flush, multi threading issues