fixed multiple template bug