Suppose the first 4 packets arrive OK. While waiting for the 5th packet, packetCount is 4 but blockPacketCount is still zero. If the 5th packet goes missing, the AA code will set packetCount based on the wrong blockPacketCount, expecting the same packet numbers again.
blockPacketCount should be incremented when blockNum 3 arrives, at the same time as blockNum is reset to zero, not set to packetNum when blockNum 0 arrives. This would have been the wrong value anyway when packetNum started at 1 because of the need to match ++packetCount.