add more checks for weak references