Fixed a couple of issues of using DM lib.