fix substraction bug and add unit test for