Fixed bug in output name generation