Updated how mode variable is injected.