Fix issue with slicing a set in a template