improved handling of remote repos (thx to cyankang)