changed reading of template files to make it work in dist and prod mode