Two things I noticed that I added to the script:
First, I added brackets around the @Database definition in the cursor. This allows for database names with periods etc.
Second, I added a check for read only databases when attempting to 'Fix' so the process does not fail.
Otherwise, good job!
Flar