Corrected few bugs related to shutdown
Basic Test Case working