fix issue with using weakmap