fixed bug in order of shutting down processes. improved logging output