Making appendCollection() more robust.