fix the ray cast bug