Improve/fix template loading