handle functions correctly in outputs