Fixed bug in chart generation