Contingency tables improvements and related bugs


![image](https://f.cloud.github.com/assets/2565497/2161061/de8561ea-94c1-11e3-9631-353c21b77ca7.png)

![image](https://f.cloud.github.com/assets/2565497/2161055/cc37ddf6-94c1-11e3-89e7-bf7d729241a6.png)