Fixed an issue with IE.

Internet exploder doesn't support substr() with negative values.