Fixed file name generator

fixes #580