added error checking
fixed bugs with line chart groupBy feature.