prepare_backup: refactor