update residual map