As you have pointed out to me privately, it might make sense to rewrite the case distinction using pcase, to avoid simple mistakes like these.