update debug code and comments.