Merge pull request #657 from chai2010/dev

Fix #656
Fix #660