Fixed dmeasure problem

Revised the code so that the dmeasure problem is solved.