Added more semantics tests. Fixed a bug.