fix #595 and fix #550

can we include in the filepath name if it is a Sample or Prep template? I think you will be able to do that by using cls.__name__ (which will be either `SampleTemplate` or `PrepTemplate`).