Fix remote add cache

Close #5919