Fixed bugs in backup script