fix a bug in the line charts, do some cleanups