changed if statment in template to fix bug