Fixed some semantic errors