fix bug. close #14, close #15, close #16