Tweaks to build under 3.x