Fix bugs in tuneup.