finally fixed nonce bug