Fix some bugs for A* integration