fixing some problems when app is multiply started