perform length check