Issue with quick.db subtract

I have been trying to make a invite manager but when a user leaves it doesn’t remove a invite and add a leave, i am not sure whats the issue

  let user = db.get(`author_${member.guild.id}_${member.id}`)
  if (!user) {
    let channel = db.get(`leave_channel_${member.guild.id}`)
    if (!channel) return;
    member.guild.channels.cache.get(channel).send(`${member.username} has left, but i can't figure out who invited him.`)
    return
  }


  console.log(`user left`)
  db.add(`invites_${member.guild.id}_${user}.leaves`, 1)
  db.subtract(`invites_${member.guild.id}_${user}.invites`, 1)
  let channel = db.get(`leave_channel_${member.guild.id}`)
  if (!channel) return;
  let leave = db.get(`leave_message_${member.guild.id}`)
  if (!leave) leave = config.leave;

  let com = leave.split("[user]")
    .join(client.users.cache.get(member.id).username)
    .split("[inviter]")
    .join(client.users.cache.get(user).username)
    .split("[invites]")
    .join(db.get(`invites_${member.guild.id}_${user}.invites`))
    .split("[total]")
    .join(db.get(`invites_${member.guild.id}_${user}.regular`))
    .split("[leaves]")
    .join(db.get(`invites_${member.guild.id}_${user}.leaves`))
    .split("[jointimes]")
    .join(db.get(`invites_${member.guild.id}_${user}.joins`))



  member.guild.channels.cache.get(channel).send(com)
}
)