fixed creation of output filename