printing data in viewer correctly