Fix some unnoticed problems introduced by python3 switch