Fix NoneType to support Python 3