base64_convert: handle to_len.  Fix #965