import lib source, fix many bug