We have error-checking in other places, but as a just-in-case (because we don't guarantee that the error-checking subs will always be called before this one -- well we do now, but who knows in the future! ) -- so just cast $ditemid to int here as well.