Fix app starting logic

Fix #862
Merge pull request #863 from bootstraponline/857

Fix app starting logic