Added stream error check functions so recovery can be attempted immediately