fixed BFS queue pushing duplicate problem