Contingency table bug fixes