Updated NuGet packages
diff --git a/src/DotPulsar/DotPulsar.csproj b/src/DotPulsar/DotPulsar.csproj
index ff7cd51..6370456 100644
--- a/src/DotPulsar/DotPulsar.csproj
+++ b/src/DotPulsar/DotPulsar.csproj
@@ -23,10 +23,10 @@
 
   <ItemGroup>    
     <PackageReference Include="HashDepot" Version="2.0.3" />
-    <PackageReference Include="Microsoft.Extensions.ObjectPool" Version="6.0.4" />
+    <PackageReference Include="Microsoft.Extensions.ObjectPool" Version="6.0.5" />
     <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
-    <PackageReference Include="protobuf-net" Version="3.0.101" />
-    <PackageReference Include="System.IO.Pipelines" Version="6.0.2" />
+    <PackageReference Include="protobuf-net" Version="3.1.4" />
+    <PackageReference Include="System.IO.Pipelines" Version="6.0.3" />
   </ItemGroup>
 
   <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
diff --git a/src/DotPulsar/Internal/PulsarStream.cs b/src/DotPulsar/Internal/PulsarStream.cs
index a57e667..188cc07 100644
--- a/src/DotPulsar/Internal/PulsarStream.cs
+++ b/src/DotPulsar/Internal/PulsarStream.cs
@@ -120,6 +120,7 @@
         try
         {
             var frameSize = _unknownFrameSize;
+            var totalSize = 0;
 
             while (true)
             {
@@ -132,8 +133,11 @@
                     if (buffer.Length < _frameSizePrefix)
                         break;
 
-                    frameSize = (int) buffer.ReadUInt32(0, true);
-                    var totalSize = _frameSizePrefix + frameSize;
+                    if (frameSize == _unknownFrameSize)
+                    {
+                        frameSize = (int) buffer.ReadUInt32(0, true);
+                        totalSize = _frameSizePrefix + frameSize;
+                    }
 
                     if (buffer.Length < totalSize)
                         break;
diff --git a/tests/DotPulsar.Tests/DotPulsar.Tests.csproj b/tests/DotPulsar.Tests/DotPulsar.Tests.csproj
index 8caf66a..a500a83 100644
--- a/tests/DotPulsar.Tests/DotPulsar.Tests.csproj
+++ b/tests/DotPulsar.Tests/DotPulsar.Tests.csproj
@@ -9,9 +9,9 @@
     <PackageReference Include="Ductus.FluentDocker" Version="2.10.45" />
     <PackageReference Include="FluentAssertions" Version="6.6.0" />
     <PackageReference Include="NSubstitute" Version="4.3.0" />
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
     <PackageReference Include="xunit" Version="2.4.1" />
-    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
+    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>