fixed undefined index issue for templates list