Fix duplicate array keys in several places