fixed some bugs in the first heuristic search