Fixed issue #534; when cancel is clicked return immediately

Fixed these two issues