Fix logic in update script