Fix error when flushing the pool