use non-strict comparison for index-direction to avoid index-direction type mismatch problems (int vs double)