Fix output name management.

Fix https://its.cern.ch/jira/browse/CAF-387