substring mistake