Fux the error in set method, and add test case for it,and add more comments