CLN: clean up format string and use IOError where appropriate