bug fixing for length

Signed-off-by: abbr <wenfred@gmail.com>