fixed a bug which caused P(Y) to be computed incorrectly