Dictionary array key handling fixes and tests