RTL problems

First time poster. I am having a problem when transitioning to RTL on my 6-rotor APM copter. Instead of flying to the launch point, it flies in a wide arc around and sometimes even away from the launch point.
I also attached my log. See that it triggers a ERR: FAILSAFE_BATT-1. This is weird because my current and voltage looks OK (above 14Volts).
However, look at the ACorrX and ACorrY. They seem to vary a lot before the crash.
What is happening here? Do I need to recalibrate something?
Thanks for your help!

Your magnetometer is doing very badly. Try moving it away from power wires and running compassmot.