Fixed bug when calculating osa residuals.