adding some error checking to the BSIM dma code