fixed adjacency checking