Fix some python deprecation warnings with -3