improved csrf token retrieval