Fix a problem when removing packages