add missing substring function (accidently forgotten)