improve handling of string/typed return values