Python 2 retrocompatibility fix