bug in neighborhood calculation