Fix a few bugs in remote setup.