fixed many bugs and optimize many modules