changes to stop service if application is killed