fixed retain cycle in demo code, added debugging macros, added weak reference macros