fixed bug on ray casting and test