Replaced occurances of mb_substr with native implementation, to avoid rebuilding php on every node.