remove unneeded packages properly