Fixed IOException handling while readSegments