Because of issues like this my approach to Advanced PDF templates is: 1. take frequent snapshots of working versions of your templates. Either number them (v1, v2, etc.) or use a date/time stamp to keep them ordered, and 2. make one small change and test it. if it breaks, revert the change or figure out why it doesn't work.