Working: change allocation on statck to the heap.