Fix 'Bad substitution' error when upgrading