Debugging legacy perl

This commit introduces some small fixes from debugging
failing testcases on legacy perl.