modify err handling