Fixed bug whereby collection we were iterating over was modified during
iteration.