Fix min length calculation