substring fix to match annoying JS regression via whalesong