Add test and some fix