Fix crash on dismiss view controller