Fixed bugs in triangle/ray intersection and added tests.