fix python 2.5 regression in tool and test_tool