fixed onFinish for optstreams, many small fixes