Change substr to slice for work in IE8.
Update unit tests