Fix for broken handling of allowed elements due to flipped array keys

Change-Id: I2e81ebe1e530816cd8e893ec6ba558e9780f6dd7