fixed bug with generatesafe