changed flushComplete to flush