Apparently the waypoints have different target heights. According to the TECS data (TECS.h , TECS.hdem) the target altitude matches the actual altitude all the way to the impact ! It is interesting that the TECS altitude always followed the mission command altitude, only suddenly it did not at the last waypoints before the impact. The reference altitude of the waypoints has not been changed, so the answer as to how this can happen is unfortunately beyond my horizon. I am also curious how this can happen.
Yeah, this is how we have been doing terrain following. We generate waypoint file with our own custom software and each waypoint has target altitude that is referenced to home altitude. Has been working just fine for years.