fix so that simulation works again. Issue #35
fix DMA end bug. Issue #35