Fix possible StringIndexOutOfBoundsException
Merge pull request #348 from dr0i/arrayExceptionFix

Fix possible StringIndexOutOfBoundsException