diff --git a/lib/galaxy/managers/collections.py b/lib/galaxy/managers/collections.py
index 24dbdff1c13..aadaf226439 100644
--- a/lib/galaxy/managers/collections.py
+++ b/lib/galaxy/managers/collections.py
@@ -126,7 +126,13 @@ class DatasetCollectionManager( object ):
if collection_type_description.has_subcollections( ):
# Nested collection - recursively create collections and update identifiers.
self.__recursively_create_collections( trans, element_identifiers )
- elements = self.__load_elements( trans, element_identifiers )
+ new_collection = False
+ for element_identifier in element_identifiers:
+ if element_identifier.get("src") == "new_collection" and element_identifier.get('collection_type') == '':
+ new_collection = True
+ elements = self.__load_elements(trans, element_identifier['element_identifiers'])
+ if not new_collection:
+ elements = self.__load_elements( trans, element_identifiers )
# else if elements is set, it better be an ordered dict!
if elements is not self.ELEMENTS_UNINITIALIZED:
diff --git a/lib/galaxy/tools/actions/__init__.py b/lib/galaxy/tools/actions/__init__.py
index e4ff04a46c2..ddefd7ffe52 100644
--- a/lib/galaxy/tools/actions/__init__.py
+++ b/lib/galaxy/tools/actions/__init__.py
@@ -770,7 +770,15 @@ def determine_output_format(output, parameter_context, input_datasets, input_dat
if collection_name in input_dataset_collections:
try:
input_collection = input_dataset_collections[collection_name][0][0]
- input_dataset = input_collection.collection[element_index].element_object
+ input_collection_collection = input_collection.collection
+ try:
+ input_element = input_collection_collection[element_index]
+ except KeyError:
+ for element in input_collection_collection.dataset_elements:
+ if element.element_identifier == element_index:
+ input_element = element
+ break
+ input_dataset = input_element.element_object
input_extension = input_dataset.ext
ext = input_extension
except Exception as e:
diff --git a/test/functional/tools/paired_collection_map_over_structured_like.xml b/test/functional/tools/paired_collection_map_over_structured_like.xml
new file mode 100644
index 00000000000..fef12be4696
--- /dev/null
+++ b/test/functional/tools/paired_collection_map_over_structured_like.xml
@@ -0,0 +1,44 @@
+
+
+
+ cat '${input1.forward}' > '${list_output.forward}';
+ cat '${input1.reverse}' > '${list_output.reverse}'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/functional/tools/samples_tool_conf.xml b/test/functional/tools/samples_tool_conf.xml
index 54e6ad0fc30..c78d1595a7d 100644
--- a/test/functional/tools/samples_tool_conf.xml
+++ b/test/functional/tools/samples_tool_conf.xml
@@ -78,6 +78,7 @@
+