added string bounds check to critical places, to avoid deopts