Fix several bug in log line parser. Thanks to Den Untevskiy for the report.