Bug Fix : Change state when application is terminated