fixed logic so view controller is dismissed correctly.
Merge pull request #203 from jodmapquest/master

fixed logic so view controllers are dismissed correctly.