replace ob_end_flush call