fix generated code for allocating arrays