Add error check in DBM
Merge pull request #924 from vdumoulin/dbm_niter

Add error check in DBM