FIX: Possible crashes relating to removal of factories. (Phil)