Fix the semigroup
fix bugs