fixing algo for Astar