Fix a few syntax / semantic errors