fixed printing code