Bug discovered while testing substitution, should hopefully be easy to
fix.