work around IE8's broken substr method