Fix for issue #311