improve fn installpackages