debugging a bug in backward bfs.