some improvements on astar