Should have fixed the infinite loops

POP function was removing the return value and not the first parameter
(or the first variable…)