fix: crash length error for substring