When I use it as library, it has some runtime errors. I fixed it. please review my patch. https://gist.github.com/1385738 Thank you.