The problem is that sometimes the dynamic legends work and sometimes they don't. Usually the first template selected works, but if you try and print a different one, the dynamic legend stops showing the correct legend. It's like there's some kind of caching problem.