Template merge fixes