Fix syntax and other errors