Resolved a leak problem and a bug(issue #23).