Python 3 compatibility updates (3.4+)