Fix strict motide warning

In strict mode the code iissues a warning caused by passing the return value of a function into array_pop which expects an array passed by reference.