fix flushing, add test for #flush