Fix #4 and Fix #3; Improved failed build recovery and trim empty log lines.