Fixed the problem where removing collection items caused the collection to be improperly indexed.