slow but proper FLANN method