add quat_stream_io and fix bug in context.cpp