Refer td->loops instead of td->o.loops to fix loop count issue