How can I raycast with chunks?
Have you confirmed that objects that clip a chunk border are stored in both chunks?

Have you confirmed that octrA[map.x/2][map.y/2][map.z/2] can't point to anything weird?

In fact, what even is octrA? I assume that it's the array storing the chunks but I can't know for sure because I couldn't find it anywhere else in your code.

Other than that I'm having a bit of a hard time interpreting the problem and your code. Could you add some pictures and comments to your code?