fixed bug in wald test