Added some fixes to make it work with the codegen