bugfixes, and printing improvements