put safeguard against nan into maximization step, just in case