Fixed a bug in BVH traveral code.