fix($handler-cleanup): address regressions in Safari, Azure #1157