Remove dead code, replace errors with right ones.