many minor improvements to ease the transition to
python3