fix errors if no csv data or incorrect last group call specified