fixed the test and the codes