$matchedtracks is broken in various ways:
1. It now always returns zero. It tries to use the passed metadata to locate the attached file and from that the album and from that the number of matched files. However, I cannot see where the file object is set in metadata.
2. This is really an album-level value - rather than a track or file level value and it should be the same for all tracks or files in an album regardless of whether the file is matched to a track or a track has a file associated with it.
3. It currently requires an argument so you can use $matchedtracks( ) with a space between the brackets, but get an error if you use $matchedtracks(). This is illogical, Captain. We should change this so the function can take 0 or 1 arguments (to avoid backward compatibility issues - or 0 or more arguments).
Anyway, I took a quick look to see if I could fix this quickly, but I can't work out how to fix it.