fix order of loading templates