Fixed a bug in the comparator for the kd-tree construction