Reimplement package_ensure