Fix replacement of varchar2 in function