Added fix for userId key casing. Added check for ad