error handling and keys for chart.