added merge logic to autobuild templates