a better updating scheme for debug