fix some pep issues and remove tempfile auto patch