Fix Issue #15 - "String index out of range"

Fixes issue #15 that I reported by re-ordering code so that string length is verified before it attempts to use the address in any way.