Fixed a bug in neighborhood iterators