invert trimming and poly fit for zams