Changed substr() calls to mb_substr() calls