Semantics update

Modify some functions and debug  the errors