Fix for issue #317