fix length check