changed InputStream to BufferedInputStream