Bugfixes in substring handling
Merge remote-tracking branch 'upstream/master' into llvm

Conflicts:
	tests/test.py