Typo in substr call