edited removepackage method