fix to calculateMdp