add substring test, and use memcpy instead of for loop, fixes #2