fix bug in code for debug.