Cleanup on script load error
Extract nonce-stuff