try niling out instead of delete, which returns what is deleted, which could be causing a weakref error