Improve the KSL code

Improve the KSL code for ray-tri intersection