updating the computation of joint probability so that it is correct (?)