Bugfix in serializing singletons