SimpleQMMM does not make correct qmatoms

I recently tried to use SimpleQMMM for water dynamics.
My system has 216 water and I divided it into QM (VASP) and MM (Lammps) regions.
I first sorted oxygen atoms for QM water and then sorted the hydrogen from the bond list for the previously sorted oxygen atoms.
Weird thing happend when I ran MD. When I check the POSCAR, the oxygen atoms are not properly sampled from my definition of QM oxygen list, but it worked correctly for QM hydrogen list.
My input geometry input has a lammps format. And I found that the when ASE sampled the qmatoms, it is very sensitive to the order of elements in lammps file. For example, if I change the order of Atoms section of my lammps data file, it gives a completely different POSCAR. Is there any specific grammer?
I also found that the ase-sort.dat has different numbers between column 1 and 2 from 25th line. If this problem happens while sorting the atoms for VASP calculations, how can I modify it?
Since I don’t understand why it happens, I need help to solve this problem if anyone had a simlilar problem before.
Thank you very much!