Fixed DeprecationWarnings for py3