fix argument ordering from generated code