changes to backupdatabase and bug fixing.