Fix issue#319
Merge pull request #364 from lilyfan/issue#319

Fix issue#319