Make sure we declare globals before using them

Follows up: I375270e5b6e688a72ec01ff9e4e018ecaaf94980

Change-Id: Iee2072ac7568afd69b070c2396d6290f595ce713