roll back to uf implementation for substr and charat