Fixed Astar class for graph over database