Perhaps you are initiating the array after you try to add data to it.
For example, plugin_precache is called before plugin_init and plugin_cfg.
Move array initialization to precache.
I'm going to create a complete example on the whole system I had in mind.