Bug fixes related to database backup, some extra logging