fix bugs in listing, finding, and using templates