thanks for the reply, I think you must be correct in pointing to the memory allocation , while trying to understand what is happening inside inside getϕ
I got into something that I can’t explain and it seems the problem is in memory allocation I posted a separate question here