Fixed a bug with sub-chart and fixed other minor bugs.