Move some more complex globals into a Singleton, which allows it being used from global destructors. It solves problems where some global variables, such as HashMaps may already be deleted, triggering crashes trying to use them.