Fix output corruption for blocking IO.