correct exception for unexpected end of stream