Fixed bug in ray traversal