a fix to fits.R