Move sudo command ahead of env variables

Environment variables will now be set when using sudo.