fixed crashes on shutdown
Merge pull request #463 from arkpar/develop

fixed crashes on shutdown