The problem of 4mm being somehow added to the Z axis position after a G28. It has nothing to do with Safe Homing, nor with Pronterface sending bad commands. I can't see anything in the G28 code that might do it either.