insert error handling