fixed bug and test working