Improve fix for #1342