Use a weak reference for the delegate.

Fix #78.