[PATCH] handle Unexpected EOF exceptions on reads