CAL-29 fix StringIndexOutOfBoundsException
Merge pull request #1 from stuartwdouglas/master

CAL-29