Fix semantic errors