handle cancel button click better