Fix bugs in reading of logs