Fix #322 & Test
Merge pull request #341 from zlx/bugfix/322

Fix #322 & Test