fixes the max_index value that was previously being passed
Merge pull request #17 from ibarroladt/fix_max_index

fixes the max_index value that was previously being passed