This is part of the SAO/CAO split series but applies without the other patches too.
What does this patch:
By now SAO's depend on factory map beeing initialized before creation of any prototype. This is ensured by compiler for global variables within one file. If prototypes are created from separate files (e.g. after splitting one big file to multiple others) this ain't guaranteed anymore.
This patch ensures initialization of factory-map on first use (thx to kahrl for the idea).
Patch V1