CLI: Fix segfault when calling get all csv (use of 'int i' in two nested for loops)

Ticket #731