Properly set environment variables in the remote command