fixes #554 weird hang/crash & race against nn_term
4 files changed