Fix Mist Shutdown

These are the fixes for #145.