Fixed bug in chart updating