kdTree bug fixed