many bugs fixed

many bugs fixed