Fix a bunch of potential syntax errors

In generated code