M step gradient checking