fix a bug in astar algorithm