fixes to visualization code