Trying to fix derivatives for EM
Fixed a bug in the analytic derivatives
Nothing works :(