M=9 behaves quite oddly, otherwise good until fit_polynomial