Must check ah->nonce before dereferencing it
Free mutex and condition variables if mg_start fails
Replace strncpy by mg_strlcpy