Revert a few commits related to #45.
A new solution to close #45. Thanks to ulion.