merge from bugfix
Merge pull request #5 from xuy/master

sync with upstream files.