Land on wrong location after RTL during auto mission

During a simple auto mission in which my quad copter is commanded to ascend 10 meters above its launch position, loiter there for 20 seconds, return to launch and land, it fails sometimes to land on the intended location (launch location). Instead, it lands about 40 meters north of it. It does not fail consistently, as can be seen from the logs, the first time the missions was completed successfully, while the second time (no changes!) fails.

When looking at the desired position (DPosX and DPosY) I notice that it suddenly changed at about (if not exactly) the time the landing started. It is a mystery to me why the desired position was altered, causing the quad copter to land on a completely different position. Note that the altitude is just fine, it slowly decreased (landing occurred controlled). I’d appreciate it if someone could shed some light on why it did not land on the launch location the second time.

I think the cause is different from the one described in a different thread. I checked the radio inputs (RCIN.C1 ~ RCIN.C8) and they seem just fine (C1 = roll, C2 = pitch, C3 = throttle, C4 = yaw, C5 = flight mode and C7 = emergency). GPS also seems fine all the time.

[attachment=0]Desired Position updated when landing starts 1024x605.png[/attachment]

Today I did some more testing and found that it happens occasionally (once in about three times) when the LAND command is executed as part of my auto mission. Find the commands that I used today. I’ve also tried the RTL command instead of the LAND command, and so far I haven’t seen the faulty behaviour when the LAND command is absent. So I suspect something is wrong with the LAND command.