fix huge bug and add some trace