implemented flush