Possible fix to #543

Will need confirmation from @Gymnasiast but this should fix the crash at startup. Issue was only occurring when you had a custom object that was composed of a very large amount theme objects (>127).