replace legacy variable substitution with the new syntax

I was getting warnings about deprecated syntax. These changes fix that.