search_nn() hangs if tree contains duplicate points, fixes #13