Navmesh agent remaining distance wrong when movement done by root motion of Mecanim?

I have an enemy agent (navmesh), who is supposed to go to a destination. However I have turned his navmesh update position off.

agent.navMeshAgent.updatePosition = false;

I am turning the corresponding anim float variable at this point to invoke the movement(root motion is ticked on my animator component).

And this is my stopping condition.

if (agent.navMeshAgent.remainingDistance <= agent.navMeshAgent.stoppingDistance && !agent.navMeshAgent.pathPending) {
			// do stuff like attacking etc
		}

The problem is that the destination that I have specified before is far away(lets say z = 100), but the navmesh stops before even reaching say z = 30 or something. I think its because I am using mecanim movement and the navmesh agent thinks that its moving at its own speed and thereby when it reaches z = 30, it thinks that it has reached z = 100. So how do I sync navmesh speed and mecanim movement speed?

hi;
try to not use remainingDistance and use Vector3.Distance to find the distance between your position and the target your self;

       if ( Vector3.Distance ( transform.position , target.position ) < 1)