improving backup function