added ob_end_flush(); and ob_start();