fix small bug with substring