further refactor load_pkg