Applied same logic for overwriting to stream version.