Fixed minor bug with heuristic.