on error, change from console output to alert
fixed dynamic history and pwd for cancel