resid bug fixed ver 1.0