bugfix for substring