Fix issues when using dmalloc