updated to flush response