Bugfix:
- Extension of the k-nearest neighbors buffer should only occur when the it would occur in the middle of the buffer or when the number of requested elements has not been reached yet.
- This fixes a bug that was noticeable when running with MSVC.