Fix problems with setting current/default input/output stream