fixed code gen for alloc