Fixed deletion of package

Modified deletePackage to remove the package entry when there were
no more versions present.