some improvements to data templates loading code