add flush, change index