Fixed issue #534; when cancel is clicked return immediately