Bug fixes in _merge_prefix and some IOStream methods.