added replacer to JSON.stringify to avoid circular deps.