pathVal should check for nils.
Simplify pathVal by making it a string.