Made the dimiss call dependent on the return value of the clicked action.