fix InputStream offset bug