Fix problem with delegate lifetime