Bugfix undefined
Using weight for astar to encourage trying new path to reach the goal