fix layout engine. close #191