fix issue #1798: commands fail after stopping and relaunching app.
Merge pull request #1957 from Jonahss/fix1798

fix issue #1798: commands fail after stopping and relaunching app.