Fixes #328

Hi. Here is a patch to fix issue #328