added existing file check for file generation