added exit in case of exception or correct working.