fix string is optional, set default length, thanks laruence