Add some error checks and reporting
Swap format string commands to squelch GCC complaints