Fixed exception in the case where _csrf_token is not available in Flask.g