fix residual scaling