fix small bugs. add deffer to test()