Bug fixes ... improvements in heuristics