Fixed problem of timestamp sometimes not being added to the output filename