Add convenience method. Fix problem in io.cpp.