improve handle error