Fixes #1.
Merge pull request #5 from jonross/iss1

Use correct substring indices