use `substr` instead of `slice`

just a minor change, but it saves a few bytes :)