nearest has bugs