Fix env= in masterless mode

Closes #7512.