added error handling for update()