CompatUtility: Fix broken custom variable dump.

Fixes #5547