Fixed resolveValue method to use recursion for sanitization