many bugs fixed