added printing demo, fixed stack imbalance bug in printer