fixing bugs in the database backup script