Fix substitution bug in Case