fix nn_shutdown function