Fixes for #1321 and #1048