improved WeakMap polyfill