Solve some bugs for set method.