Fix reference to correct length variable

Signed-off-by: Daniele Ricci <daniele.athome@gmail.com>