fixed non NULL CHR length, replaced with actual string length