make term and path immutable and avoid deep copy for string, term and path to optimilize copying