Use io instead of cStringIO