Was this the cause of the loop failure (modifying the `**ptr` argument)?