Restore python3 compatibility