some small optimization in contact solver, also a rare crash bug