Fixed bug related to visited bit array