debug

fix many bugs