Fix logging ordering issue, fix printing bug.