Bug fix: not correctly substituting parameters