Fix strange behaviour with overriding main template