code semantics fixed