Fix conditional environment assignment.