When I call localization with less than 5 output arguments then it does not return anything. This is because of line 71. I suggest to remove the if-statement on line 71. Is there any reason why it should stay?