BuildKDTree is not working properly (only 15 of 27 knots are added to the tree)