Access variables as map when possible (#14192)

Change-Id: I88a76ad95608f7a26d969b958b16861928d7d25d