add protection when using 'gen' files