(0.9.37-unstable) Backport over changes to dma.cpp