Add debug to writeout