fix Cannot read property 'nonce' of undefined