some fixes to handling collections