IOStream: drainIfMatch critical bugfix