In theory, this should also work on UBB 6.1 but that shouldn't be a cause for avatar_clean.cgi (just disable the check for UBB 6.2 but putting # in front of the relevant statements that check for UBB 6.2 near the top).
Secondly, try switching the following code in avatar_clean.cgi:
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.