Bounds IntersectRay distance isnt correct

Hey,
I’ve been working with Bounds.IntersectRay recently and i have an issue with the distance being incorrect.
for example,
if i would do :

float distance;
Bounds testBounds = new Bounds(center, size);

if(testBounds.IntersectRay(new Ray(origin, direction), out distance))
{
    Debug.Log(distance);
}

It does return true, that works great. but the issue is that the distance it returns is wrong. if i compare it to the distance that is coming from the Physics.Raycast it is completely different.
While the physics raycast distance is 3, the distance from the bound intersectRay would be 14 - 17 or even more.

My question is: is it an issue from my side or is that maybe a bug?
Unity version : 5.1.3p1.
Been trying to debug this for a while and try different solutions but it doesnt seem to ever work well.

Thanks,
Elroy.

Nvm i fixed the issue.
the trick is to use the center as the position of the object you want to raycast on.
the reason i had an issue is because i transformed my direction and origin into the local points in the object.

Sorry for the bother :).
Elroy.