Fix a slight bug that causes double printing.