Minor bug fixes and partial DMA code merge