Some fixes to heuristics