Partial fix to issue #349