Fixed isssues with neighbor counting