fix connection to remote and localhost