some bug fixe, add flush options