Is there a perl IDE like MS Visual Studio for C++? You can follow into the functions, see the value of variables.
When I look at the code, I suspect that if you look at the order property 'COORDINATE_LABELS' you will see that the facets are also shifted by one.