fix issue #291
Merge branch 'master' into wasabiz/issues/291
add a test case
Merge pull request #293 from jsx/wasabiz/issues/291

fix issue 291