Fixed some loop problems in RotateBackups and ListDatabases