substitute() behaves more consistently now

Change-Id: I11a7edcbc1b27b5ac9d587c1d7d2459b5f33be19