update connect_remote and others to handle json cfg and python2 and python3