modified flush method