chi-square p3 update

p3 had minor bugs