chaningprinttowrite and debugging