problems with nan in likelihood calculation