Fixed debug_to_file

- Works again in the c backend
- Can debug_to_file the output func