I found that a huge offset is sometimes injected in Z correction and the Z correction unlocks due to it. I also found that the huge offset appears when I touch the LEMO cable between rampeauto and SR560 in Z correction loop. I replaced the LEMO cable and the problem was solved.