added a fix to make sure data is a collection before trying to transform() it