adding if check to allow template to render