fixed the heuristic calculation