fix token count bug, print bug, debug output