flush-swap: add error control, and better output