replaced substr with mb_substr