corrected error in variable substitution