Fixes for #1083 and #1090.