substitute variables before run