add error handling for update