use `substr` instead of `slice`

just a minor change, but it saves a few bytes :)
Merge pull request #162 from fb55/patch-1

Use `substr` instead of `slice`