Fix bug in CalcLikelihoodMatrix
Fix compatibility issue