You are passing in a variable called title to the second function. This will hide the function of the same name so that this instruction:
is no longer calling the title function, but is instead trying to index into your variable called title using dataset.subtitle(i) as an index.
Rename your variable to something else and it should be fine.
Always try to remember never to use function names as variable names!!