fixing issues with delegate dealloc