Fix template adding problem