[Core] Fix BIH::intersectRay crash. Thanks TC

Assure that BIHWrap::remove(const T& obj) actually removes every reference of obj from BIHWrap.
Also add sanity checks to MDLCallback () functions to avoid array overruns.