Fix for issue #366