added some fixes that should make visualization more accurate