add origin to grep;add better upstream check