some speed up and bug fixes, first step towards faster coherence match