ray-aabb intersection

Hi there,
there is a question again to volume rendering. I have an
octree encoded in a 3d texture but only the deepest level.
In my case, 32x32x32. Furthermore, there is a min max texture.
The octree 3d texture holds at every texel the min and max value.
With this value, I look up in the minmax texture. The result is
0 or 1, for non visible or visible.

Volume rendering is done by raycasting. With the current sample position I look up at the octree texture and I can calculate the
boundaries of the surrounding sub cube.

vec3 box_min = floor(samplePos / boxsize) * boxsize;
vec3 box_max = box_min + vec3(boxsize,boxsize,boxsize);

Currently I calculate the distance vector between the sample position and box_max. Then I take the smallest component of this vector. Then this distance is devided by the size of a ray increment (t => r = r0 +t * dir). This gives me the
number of samples I can skip and reaches the next sub cube.

But this doesnt work. I guess the calculated "t" is too small. Sometime I see nothing and then the raycasted picture
is distorted. I tried a ray-aabb intersection with slabs.
But actually with respect to the current sample position, the
rays origin is always inside of a cube.

Can anyone help me ?

I tried this one, but that doesnt seem to work. And I also wonder about the ns = min(1, nsi) line on the right side.

Hope there is someone who can help me