Fix crash because of invalid output filename