handling circular refs when stringifying obj to JSON