fix issue 339
Merge pull request #340 from xuwei-k/issue339

fix issue 339