Improvements to singleton handling