scoping variables because of 'dynamic lookup' deprecation