Handle valid but invalid length correctly