Backport fix complex polynomial fit