made a save gate for overwriting files