lots of fixes for collection swapping.