Improve CSRF handling a bit