Additional fixes to Bag and KeyBag.