Fixed handling of cancel button click handlers