expand path only if necessary