Fixed stack issues in printing.