fix for #982, fix condition for copying discrete objects to intermediate buffers in the unified memory case