Fixed a bug in neighbor list construction