Internal cleanup for Flask.