Fixed single-application instance issue

I just fixed on a separate branch.