LPS-45067 Avoid inputstream lost bytes