Fix some bugs and improve codes for extented modules