fixed bug in mapNeighborsND. This fixes earlier bug