Fixed code for update