Fix update bug and remove dangerous code.