Fix InputStream bug