Improved update_csrf() method.