Partial Python 3 compatibility for 0.7.0