added load package function
fix bugs in last commit