Fixed bug in ToDump function that caused failure when `--no-payload` flag was used without summary. The if condition assumed that there would be something to write, but fwrite returns 0 when it writes nothing and when an error occurs. Adding a check of the count to write solves the problem.