fix some issues, also better printing