bunch of fixes for deleting packages