Fix some compatibility issues

- Use `String.charAt(index)` instead of array like syntax for browser compatibility.
- Use `Array.slice(index, length)` instead of `Array.slice(index)` for browser compatibility.
Merge pull request #92 from meziantou/patch-1

Fix some compatibility issues