Fix stream equality check. Patch applied from Craig Drummond