Merge pull request #306 from lfei815/issue305

Fixing issue 305.