Fix some bugs of Peg library