fixed bug and test