Fix bug in index parameter parsing.
Fix defaulting to stdout for output.