updating with id check