Fix a problem where flush future is set more than once