fix crash when loading modal view and assigning the delegate