Fixing issues with generator and creation of files