Bug fixes in backup.py