Made DataStream::read more robust on errors.