Added autoincrement on template id field