proper error handling in janus_io.cpp