Fixed bug in detection of termination

and changes in log format