Fix crash when saving residuals/fitted with missings