diff --git a/ebpfcat/ethercat.py b/ebpfcat/ethercat.py
index 0cd07a72c7f7348957cb9489095003f25e8269d0..8c6b51fbaf3cd315d8a1995d3e3452563045f844 100644
--- a/ebpfcat/ethercat.py
+++ b/ebpfcat/ethercat.py
@@ -375,7 +375,7 @@ class EtherCat(Protocol):
         p = Packet()
         p.append(ECCmd.APRD, b"\0\0", 0, 0, 0x10)
         ret = await self.roundtrip_packet(p)
-        no, = unpack("<h", ret[16:18])  # number of terminals
+        no, = unpack_from("<h", ret, 18)  # number of terminals
         return no
 
     async def find_free_address(self):