Fix substring typing

The last change introduced a bug where substring types were being fixed
as CHAR.