The logic for the ^pos(place) function is incorrect when handling 1st and 2nd.
int value = (int)Convert2Integer(arg2);
if ((value) == 1) sprintf(buffer,"%dst",value);
if ((value) == 2) sprintf(buffer,"%dnd",value);
if ((value) == 3) sprintf(buffer,"%drd",value);
else sprintf(buffer,"%dth",value);
The numbers ending 1 and 2 are independent tests and hence get trampled over by the else when it is not ending in 3!