Some minor 3.1.X compatibility fixes.