Make code compatible with Python 3.10