fixed the unwind segue so that it can pop or dismiss accordingly