Fix a condition in connected_moves()