Fix some weird errors in the charting routines