Merge pull request #362 from wcwang/next

Bugs fixing