fix current fragment index check when multiple fragments have same index

(cherry picked from commit cbef64b860e75e010a383543de3c5f478fc4227a)