fix the bug and finish the printing